#include <unistd.h>
#include "Thread.hpp"
using namespace ThreadModule;

void routine(int cnt)
{
    while(cnt--)
    {
        std::cout << "我是一个新线程" << std::endl;
        sleep(1);
    }
}

int main()
{
    int cnt = 10;
    Thread<int> t(routine, cnt);
    t.Start();
    t.Detach();

    sleep(7);

    t.Stop();

    sleep(5);

    t.Join();

    std::cout << "新线程结束" << std::endl;

    return 0;
}